#!/usr/bin/env bash

set -e

while getopts "v" option; do
  case "${option}" in
    v)
      verbose=-v
      ;;
  esac
done

grep -l PropsDictType troposphere/*.py | \
    cut -d/ -f2 | \
    cut -d. -f1 | \
    sed -e '/^__init__/d' -e '/^constants/d' -e '/^policies/d' | \
    sed -e '/^serverless/d' -e '/^template_generator/d' -e '/^utils/d' | \
    sed 's/^analytics$/kinesisanalytics/' | \
    sed 's/awslambda/lambda/' | \
    sed 's/^firehose$/kinesisfirehose/' | \
    sort > autogen
python3 scripts/gen.py --filelist autogen -d troposphere ${verbose}
make fix
